package com.qj.daibei.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qj.daibei.mapper.RepaymentCustomTestMapper;
import com.qj.daibei.pojo.RepaymentCustomTest;
import com.qj.daibei.service.RepaymentCustomTestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * author wml
 * Created on 2021/10/27 22:27
 */
@Service
public class RepaymentCustomTestServiceImpl implements RepaymentCustomTestService {

    @Autowired
    private RepaymentCustomTestMapper repaymentCustomTestMapper;

    @Override
    public List<RepaymentCustomTest> findRepaymentAndShouldPayBackAndLoan(Integer userId) {
        return this.repaymentCustomTestMapper.findRepaymentAndShouldPayBackAndLoan(userId);
    }

    @Override
    public PageInfo<RepaymentCustomTest> findRepaymentAndShouldPayBackAndLoanByPage(int pageNum, Integer userId) {
        PageHelper.startPage(pageNum, 6);
        List<RepaymentCustomTest> repaymentAndShouldPayBackAndLoan = this.repaymentCustomTestMapper.findRepaymentAndShouldPayBackAndLoan(userId);
        PageInfo<RepaymentCustomTest> pageInfo = new PageInfo<>(repaymentAndShouldPayBackAndLoan, 5);
        return pageInfo;
    }
}
